import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'index',
    component: () => import('../views/layout/Index.vue'),
    redirect: '/bar',
    meta: { title: '图形', icon: 'el-icon-s-home' },
    children: [
      {
        path: '/bar',
        name: 'bar',
        component: () => import('../views/echarts/bar.vue'),
        meta: { title: 'bar图', icon: 'el-icon-s-home' },
      },
      {
        path: '/line',
        name: 'line',
        component: () => import('../views/echarts/line.vue'),
        meta: { title: 'line图', icon: 'el-icon-s-home' },
      }
    ]
  },
  {
    path: '/table',
    name: 'index',
    component: () => import('../views/layout/Index.vue'),
    redirect: '/table1',
    meta: { title: '表格', icon: 'el-icon-setting' },
    children: [
      {
        path: '/table1',
        name: 'table1',
        component: () => import('../views/tables/table1.vue'),
        meta: { title: '表格1', icon: 'el-icon-setting' },
      },
      {
        path: '/table2',
        name: 'table2',
        component: () => import('../views/tables/table2.vue'),
        meta: { title: '表格2', icon: 'el-icon-setting' },
      }
    ]
  },



]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
